<?php
// Affichage du menu
echo $menuexiste = displaMen(true);
?>

<?php
function displayAddForm($listPays, $listVilles, $element, $typeOffres, $singleAnnonce, $modif) {
	
	// Variable retourner pour la modification
	$singleAnnonce['ANN_TITRE'];

	// Switch des titres
	// Modif ou Nouvelle annonce
	$pageTitre = null;
	if($modif == 1)
		$pageTitre = "Modification";
	else
		$pageTitre = "Nouvelle annonce";
?>
	<form name="ADD_FORM" method="POST" action="?content=ajouter&add=true" onSubmit="return verifAnnonce();" enctype="multipart/form-data">
		<table style="width:100%">
			<tr>
				<td>
					<div id="annonce">
						<h1>Nouvelle annonce</h1><hr />
						<br />
						<table>
							<tr>
								<td>Type d'annonce</td>
								<td>
									<input name="CAT_ANN_ID" type="radio" value="1" id="Demande" checked="Checked" onClick="" />J'envoie
									&nbsp;&nbsp;&nbsp;&nbsp;
									<input name="CAT_ANN_ID" type="radio" value="2" id="Offre" onClick="" />J'accompagne
								</td>
							</tr>
							<tr>
								<td>Pays de d&eacute;part *</td>
								<td>
									<select name="ANN_DEP_PAYS" id="ANN_DEP_PAYS">
										<option value="1"></option>
										<?php
										foreach ($listPays as $pays){
											?>
										<option value="<?php echo $pays['PAYS_NOM']; ?>">
											<?php echo $pays['PAYS_NOM']; ?>
										</option>
										<?php
										}
										?>
									</select>
								</td>
							</tr>
							<tr>
								<td>Code Postal / Commune</td>
								<td>
									<input name="ANN_DEP_CP" type="cp" placeHolder="Code Postal" maxlength="5" value="<?php $singleAnnonce['ANN_DEP_CP']; ?>" />
									<input name="ANN_DEP_COMMUNE" type="commune" placeHolder="Commune" value="<?php $singleAnnonce['ANN_DEP_COMMUNE']; ?>" />
								</td>
							</tr>
							<tr>
								<td>Pays d'arriv&eacute;e *</td>
								<td>
									<select name="ANN_ARR_PAYS" id="ANN_ARR_PAYS">
									<option value="1" ></option>
									<?php
									foreach ($listPays as $pays){
									?>
									<option value="<?php echo $pays['PAYS_NOM']; ?>">
										<?php echo $pays['PAYS_NOM']; ?>
									</option>
									<?php
									}
									?>
									</select>
								</td>
							</tr>
							<tr>
								<td>Code Postal / Commune</td>
								<td>
									<input name="ANN_ARR_CP" type="cp" placeHolder="Code Postal" maxlength="5" value="<?php $singleAnnonce['ANN_ARR_CP']; ?>" />
									<input name="ANN_ARR_COMMUNE" type="commune" placeHolder="Commune" value="<?php $singleAnnonce['ANN_ARR_COMMUNE']; ?>" />
								</td>
							</tr>
							<tr>
								<td>Date de d&eacute;part *</td>
								<td><input name="ANN_DATE_DEPART" type="text"
									placeHolder="" value="<?php $singleAnnonce['ANN_DATE_DEPART']; ?>" /></td>
							</tr>
							<tr>
								<td>&nbsp;</td>
								<td>&nbsp;</td>
							</tr>
							<tr>
								<td id="quoi">Que voulez envoyer ? *</td>
								<td>
									<input name="ANN_TYPE_ENVOI" type="radio" value="Colis" id="ANN_TYPE_ENVOI" checked="Checked" onClick="" />Colis&nbsp;
									<input name="ANN_TYPE_ENVOI" type="radio" value="Documents" id="ANN_TYPE_ENVOI" />Documents&nbsp;
									<input name="ANN_TYPE_ENVOI" type="radio" value="Autres" id="ANN_TYPE_ENVOI" />Autres
								</td>
							</tr>
							<tr>
								<td>Caract&eacute;ristiques</td>
								<td>
									<input name="ANN_POIDS" type="carac" placeHolder="Poids(KG)" value="<?php $singleAnnonce['ANN_POIDS']; ?>" />
									&nbsp;&nbsp;
									<input name="ANN_LONG" type="carac" placeHolder="Longueur" value="<?php $singleAnnonce['ANN_LONG']; ?>" />									
									<input name="ANN_LARG" type="carac" placeHolder="Largeur" value="<?php $singleAnnonce['ANN_LARG']; ?>" />									
									<input name="ANN_HAUT" type="carac" placeHolder="Hauteur" value="<?php $singleAnnonce['ANN_HAUT']; ?>" />
								</td>
							</tr>
							<tr>
								<td>Envoi sous douane ? *</td>
								<td>
									<input name="ANN_ENV_DOUANE" type="radio" value="Oui" id="Demande" checked="Checked" />Oui&nbsp;&nbsp;
									<input name="ANN_ENV_DOUANE" type="radio" value="Non" id="Offre" />Non
								</td>
							</tr>
							<tr>
								<td>Titre &agrave; votre annonce *</td>
								<td><input name="ANN_TITRE" type="text"
									placeHolder="" value="<?php $singleAnnonce['ANN_TITRE']; ?>" /></td>
							</tr>
							<tr>
								<td>Description de l'annonce *</td>
								<td><textarea name="ANN_DESCRIPTION" id="ANN_DESCRIPTION"></textarea></td>
							</tr>
							<tr>
								<td>* Champs obligatoires</td>
								<td>
									<input name="ANN_SUBMIT" type="submit" value="Valider" />
								</td>
							</tr>
						</table>
					</div>
				</td>
			</tr>
		</table>
	</form>
	<br />
<?php
}
displayAddForm($listPays, $listVilles, $element, $typeOffres, $singleAnnonce, $modif);
?>
